﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper;
using Dapper.Contrib.Extensions;

namespace Topro.Application.Impl
{
    using Topro.Application.Interface;
    using Topro.Db;
    using Topro.Entity.Response.Tunnel;
    using Topro.Log;

    /// <summary>
    /// 巷道业务接口实现
    /// </summary>
    public class TunnelServiceImpl: TunnelService
    {
        #region 注入
        /// <summary>
        /// db
        /// </summary>
        private readonly IDb _db;

        /// <summary>
        /// loggerService
        /// </summary>
        private readonly LoggerService _loggerService;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dapperFactory"></param>
        /// <param name="logger"></param>
        public TunnelServiceImpl(IDb db, LoggerService loggerService)
        {
            _db = db;
            _loggerService = loggerService;
        }
        #endregion

        /// <summary>
        /// 获取巷道列表
        /// </summary>
        /// <param name="status">状态</param>
        /// <returns></returns>
        public List<TunnelResponse> GetListByStatus(int status)
        {
            return _db.DbConnection.Query<TunnelResponse>("select Id,Name,Status,CreatedBy,CreatedDate from t_tunnel where Status=@Status", new { Status = status }).ToList();
        }
    }
}
